from django.db import models
from User.models import User


# Create your models here.
from utils.dateFun import getNowTimeStamp


class SearchRecord(models.Model):
    """
    搜索记录表
    """
    id = models.CharField(verbose_name='搜索记录ID', max_length=255, null=False, primary_key=True)
    type = models.CharField(verbose_name='搜索类型', max_length=255, null=False)
    content = models.TextField(verbose_name='搜索内容', null=False)
    isCollect = models.BooleanField(verbose_name='是否收藏', null=True, default=False)
    creatTimeStamp = models.CharField(verbose_name='创建时间', max_length=255, null=True, default=getNowTimeStamp())
    user = models.ForeignKey(verbose_name="用户ID", to=User, to_field='uid', on_delete=models.CASCADE)

    class Meta:
        db_table = 'SearchRecord'
        verbose_name = '搜索记录表'
